package com.starlink.utils;

import java.util.concurrent.atomic.AtomicLong;

/** 
 * 获取long型唯一ID
 */
public class IDUtils
{

    private static final AtomicLong tmpID = new AtomicLong(System.currentTimeMillis());

    public static long getId() {
        long ltime = tmpID.getAndIncrement();
        String idStr = ltime + String.format("%04d", (int)(Math.random()*10000));
        return Long.parseLong(idStr.substring(0, 16));
    }
}